from tkinter import *
import sqlite3
from LibDbInit import LibDbInit
import os

class App(Frame):
    def __init__(self, master=None):

        self.dbconn = sqlite3.connect(dbpath)
        self.cursor=self.dbconn.cursor()
        
        
        super().__init__(master) #Frame组件，master父组件

        self.show()
        #self.button=Button(self,text=u"查询",command=self.querydb)
        #self.button.pack(side="top")
        #self.button=Button(self,text=u"录入",command=self.querydb)
        #self.button.pack(side='left')
        #self.button=Button(self,text=u"修改",command=self.querydb)
        #self.button.pack(side='bottom')
        #self.button=Button(self,text=u"退出",command=root.destroy)
        #self.button.pack(side='right')
        
    def show(self):
        self.QueryButton=Button(self,text=u"查询",command=self.querydb)
        self.QueryButton.pack()
        
    def querydb(self):
        print('test')
    def insertdb(self):
        pass
    def updatedb(self):
        pass
    
    
        

if __name__=='__main__':

    dbpath='zlpsql.db'
    if not os.path.exists(dbpath):
        LibDbInit(dbpath)
    # create the application
    root=Tk()
    myapp = App(master=root)

    #
    # here are method calls to the window manager class
    #
    myapp.master.title(u"整理率报表")
    myapp.master.minsize(1000,400)
    
    # start the program
    myapp.mainloop()
